Skip to content

Provide type-based quick info on symbol-less nodes#3022

Merged
jakebailey merged 1 commit intomicrosoft:mainfrom
Andarist:quick-info-from-type
Mar 11, 2026
Merged

Provide type-based quick info on symbol-less nodes#3022
jakebailey merged 1 commit intomicrosoft:mainfrom
Andarist:quick-info-from-type

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Mar 8, 2026

No description provided.

// | ----------------------------------------------------------------------
// | No quickinfo at /**/.
// | ```tsx
// | any
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one doesn't resolve correctly but it's a separate issue

@ahejlsberg
Copy link
Member

Unfortunately, this isn't the right way to fix the issue. We already have infrastructure in place that creates synthetic symbols for index-signature-based property and element accesses (see getApplicableIndexSymbol), but it isn't working right and it also is odd in that it creates symbols whose type you can't obtain using getTypeOfSymbol. I will be putting up a PR that fixes this.

@Andarist Andarist force-pushed the quick-info-from-type branch from 82765e5 to 0d189eb Compare March 11, 2026 08:36
@jakebailey
Copy link
Member

is this still needed after #3018?

@Andarist
Copy link
Contributor Author

This is kind of a pure port from Strada - you can see how a bunch of failingTests are removed here. This branch is already based now on top of #3018 - so the diff you see is not outdated or anything like that.

@jakebailey jakebailey added this pull request to the merge queue Mar 11, 2026
Merged via the queue into microsoft:main with commit a4ea5bd Mar 11, 2026
21 checks passed
@ahejlsberg
Copy link
Member

Hmm, as I said above, I don't think this code is right--even if it was in Strada. Some of those tests change quick info on an error location from displaying nothing to displaying any (which is actually the errorType). How is that better?

@Andarist
Copy link
Contributor Author

As a user, that displayed any is what I expect - it might be an acquired expectation but now it would feel slightly off to me if those wouldn't display anything.

@jakebailey
Copy link
Member

Yes, I would tend to agree, that if we are hovering on an identifier-y thing, we need to display something...

@Andarist Andarist deleted the quick-info-from-type branch March 11, 2026 17:13
@ahejlsberg
Copy link
Member

I gotta say I disagree here. If the type returned from GetTypeAtLocation is the error type (meaning there's no type), how are we helping anyone by displaying any? Which is indistinguishable from an actual non-error any.

@Andarist
Copy link
Contributor Author

To some extent, it's about cross-location consistency:

function test(o: unknown) {
    //   ^? function test(o: unknown): any
    return o.foo
    //       ^? any
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants